<template>
    <div class="app">
        <div class="tree">

            <el-tree :data="dataTree" show-checkbox node-key="id" :default-checked-keys="defkeys" default-expand-all
                :props="defaultProps">
            </el-tree>

        </div>
    </div>
</template>
    
<script>
import infras from "@/serive/Infrastructure";
export default {
    data() {
        return {

            dataTree: [],//对应tree的数据
            defaultProps: {
                children: 'classroomVos',//看数据返回是否是children，具体情况看返回是什么
                label: 'className'//authName是数据返回文本的字段
            },
            defkeys: [],//默认勾选对应的值
            state: '1'
        
        };
    },
    methods: {
        handleNodeClick() {
            infras.classroom(this.state, this.dataTree).then((res) => {
                this.dataTree = res.data.data
                // this.storageDto.total = res.data.total
                // console.log(this.userList);
                console.log(this.dataTree[0].className);
            })

        }
    },
    created() {
        this.handleNodeClick();
    },
};
</script>
<style>
.el-tree{
    margin-top: -20px;
    border-radius: 20px;
    box-shadow: 0px 20px 50px 0px rgba(191, 21, 108, 0.05) !important
}
</style>